<@override name="content">
<form class="form-horizontal" id="submitForm" action="solution/save" method="post">
  <input class="input-small" type="hidden" id="inputPid" name="solution.pid" value="${problem.pid!}">
  <div class="control-group solution">
    <label class="control-label" for="inputTitle">Title</label>
    <div class="controls">
      <span id="title"><a href="problem/show/${problem.pid!}">${problem.title!}</a></span>
    </div>
  </div>
  <div class="control-group solution">
    <label class="control-label" for="inputTimeLimit">Time Limit</label>
    <div class="controls">
      <span id="timeLimit">${problem.timeLimit!1000} MS</span>
    </div>
  </div>
  <div class="control-group solution">
    <label class="control-label" for="inputMemoryLimit">Memory Limit</label>
    <div class="controls">
      <span id="memoryLimit">${problem.memoryLimit!65536} KB</span>
    </div>
  </div>
  <div class="control-group">
    <label class="control-label" for="inputLanguage">Language</label>
    <div class="controls">
      <select class="input-small" id="inputLanguage" name="solution.language" accesskey="l"> 
      <#if program_languages??> 
      <#list program_languages.keySet() as key>
        <option value="${key!}"<#if (solution.language)??><#if solution.language==key>selected</#if><#else><#if
          user.language==key>selected</#if></#if>>${program_languages.get(key)!}</option> 
      </#list> 
      </#if>
      </select>
    </div>
  </div>
  <div class="control-group solution">
    <label class="control-label" for="inputSource">Source Code</label>
    <div class="controls">
      <div id="file_div" ></div>
      <div id="file_parent" style="padding: 10px;">
        <textarea id="inputSource" minlength="10" maxlength="30000" name="solution.source" rows="20" cols="120" required accesskey="c">${(solution.source)!}</textarea>
      </div>
      <div class="syntax-box">
        <input type="hidden" name="syntax" value="0">
        <label for="syntax" class="checkbox"><input type="checkbox" name="syntax" id="syntax" value="1" checked="checked" accesskey="h"> <span>syntax highlight</span></label>
      </div>
    </div>
  </div>
  <div class="control-group">
    <div class="controls">
      <button type="submit" id="Submit" class="btn btn-primary" accesskey="s">Submit</button>
      <button type="reset" class="btn btn-info" accesskey="r">Reset</button>
    </div>
    <div class="pull-right">
      <p class="text-error" id="error"></p>
    </div>
  </div>
</form>
</@override>

<@override name="scripts">
  <script src='assets/jquery-validation/dist/jquery.validate.min.js' type='text/javascript'></script>
  <script src='assets/ideone/ace.js' type='text/javascript'></script>
  <script src='assets/ideone/jquery.textarea.js' type='text/javascript'></script>
  <script src='assets/ideone/ideone-common.js' type='text/javascript'></script>
  <script type="text/javascript">   
    $().ready(function() {
      <#if !(solution.language)??>
      if ($.cookie && $.cookie("program_language") != null) {
        $('#inputLanguage').val($.cookie("program_language"));
      }
      </#if>
      $("#submitForm").validate();
    });
  </script>
</@override>
<@extends name="../common/_layout.html" />
